{% extends "base.html" %}
{% import "bootstrap/wtf.html" as wtf %}
{% import "_macros.html" as macros %}

{% block title %}万屏时代OPC--微信菜单列表{% endblock %}

{% block panel_heading %}
  万屏时代OPC--微信菜单列表
    <div class="pull-right btn-group">
        <a href="{{ url_for('opc_wechat_bp.wechat_menu_add') }}" class="btn btn-xs btn-success" style="margin-right: 5px;">
            新增菜单
        </a>
        <a href="{{ url_for('opc_wechat_bp.wechat_menu_sync') }}" class="btn btn-xs btn-warning" onclick='return confirm("确定要同步此菜单到微信公众号上吗?")' style="margin-right: 5px;">
            同步到微信公众号
        </a>
    </div>
{% endblock %}

{% block panel_body %}

    {% if pagination %}
    <div class="pagination">
        {{ macros.pagination_widget(pagination, 'opc_wechat_bp.wechat_menus_list') }}
    </div>
    {% endif %}

    <table id="wechat_menu_table" class="table table-bordered table-hover table-condensed table-striped table-responsive" style="table-layout: fixed;">
        <thead>
            <tr>
                <th>ID</th>
                <th>级别</th>
                <th>父级菜单</th>
                <th>排序</th>
                <th>类型</th>
                <th>名称</th>
                <th>网页链接</th>
                <th>小程序appid</th>
                <th>小程序pagepath</th>
                <th>key</th>
                <th>创建时间</th>
                <th>修改时间</th>
                <th>操作</th>
            </tr>
        </thead>
        <tbody>
            {% for menu in wechat_menus %}
            <tr>
                <td>{{ menu.id }}</td>
                <td>{{ menu.level_display }}</td>
                <td>{{ menu.pid_display }}</td>
                <td>{{ menu.idx }}</td>
                <td>{{ menu.type_display }}</td>
                <td>{{ menu.name }}</td>
                <td style="text-overflow: ellipsis; white-space: nowrap; overflow: hidden;">{{ menu.url }}</td>
                <td>{{ menu.appid }}</td>
                <td>{{ menu.pagepath }}</td>
                <td style="text-overflow: ellipsis; white-space: nowrap; overflow: hidden;">{{ menu.key }}</td>
                <td>{{ menu.created_datetime }}</td>
                <td>{{ menu.updated_datetime }}</td>
                <td>
                    <a href="{{ url_for('opc_wechat_bp.wechat_menu_edit', menu_id=menu.id) }}" class="btn btn-xs btn-info">编辑</a>
                    {% if not menu.deleted_at %}
                        <a href="{{ url_for('opc_wechat_bp.wechat_menu_del', menu_id=menu.id) }}" class="btn btn-xs btn-danger">删除</a>
                    {% else %}
                        <a href="{{ url_for('opc_wechat_bp.wechat_menu_del', menu_id=menu.id) }}" class="btn btn-xs btn-warning">恢复</a>
                    {% endif %}
                </td>
            </tr>
            {% endfor %}
        </tbody>
    </table>

    {% if pagination %}
    <div class="pagination">
        {{ macros.pagination_widget(pagination, 'opc_wechat_bp.wechat_menus_list') }}
    </div>
    {% endif %}
{% endblock %}

